<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker,autocomplete"></t:base>
<div class="easyui-layout" fit="true">
    <div region="center" style="padding:0px;border:0px">
        <t:datagrid  name="mainlist" pagination="true" fitColumns="false" title="" onLoadSuccess="doload"  onClick="onselect" isComplexTitle="true"  actionUrl="sjxypzController.do?mlistDatagrid" idField="id" fit="true" queryMode="group">
            <t:dgCol title="id"  field="id"   hidden="true"   queryMode="group"  width="120"></t:dgCol>
            <t:dgCol title="协议名称"  field="fd_pname"  width="100"></t:dgCol>
            <t:dgCol title="矿区"    field="fd_kq" width="100"></t:dgCol>
			<t:dgCol title="操作" field="opt" width="60"></t:dgCol>
			
            <t:dgDelOpt title="删除" url="sjxypzController.do?dodel&id={id}" urlclass="ace_button"  urlfont="fa-trash-o"/>
            <t:dgToolBar title="录入" icon="icon-add" url="sjxypzController.do?edit" funname="add" width="770" height="500"></t:dgToolBar>
            <t:dgToolBar title="编辑" icon="icon-edit" url="sjxypzController.do?edit" funname="update" width="770"></t:dgToolBar>
        </t:datagrid>
    </div>
</div>
<script type="text/javascript">
function onselect(rowData) {

    var selected = $('#mainlist').datagrid('getSelected');
    window.parent.onetableid = selected.id;
    window.parent.suber.location.replace("<%=request.getContextPath()%>/sjxypzController.do?subtitle&keyid="+window.parent.onetableid+"&pno="+window.parent.pageSelected);
}

function doload(rowData){
    var selected = $('#mainlist').datagrid('getSelected');
    if(selected) {
        var ntotlength = rowData.rows.length;
        if(ntotlength < 1) {
            window.parent.suber.location.replace("/tk/webpage/common/Blank.jsp");
            window.parent.onetableid = "";
        }
    } else {
        var ntotlength = rowData.rows.length;
        if(ntotlength > 0) {
            $('#mainlist').datagrid('selectRow',0);
            var selected = $('#mainlist').datagrid('getSelected');

            window.parent.onetableid = selected.id;
            window.parent.rowIndex   = 0;
            var urls="<%=request.getContextPath()%>/sjxypzController.do?subtitle&keyid="+window.parent.onetableid+"&pno="+window.parent.pageSelected
            window.parent.suber.location.replace(urls);

       } else {
            window.parent.suber.location.replace("/tk/webpage/common/Blank.jsp");
            window.parent.onetableid = "";

        }
    }



}
</script>